package com.webside.front.search.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webside.base.baseservice.impl.AbstractService;
import com.webside.front.common.mapper.BSeriesMapper;
import com.webside.front.common.mapper.BdictionaryMapper;
import com.webside.front.common.model.BSeries;
import com.webside.front.common.model.Bdictionary;
import com.webside.front.search.service.SearchService;
import com.webside.util.PageUtil;

@Service("searchService")
public class SearchServiceImpl implements SearchService {
	@Override
	public List<Bdictionary> findBdictionariesKeywords() {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysKeywords();
	}

	@Autowired
	private BdictionaryMapper bdictionaryMapper;
	
	@Autowired
	private BSeriesMapper bSeriesMapper;
	 
	
	public BSeriesMapper getbSeriesMapper() {
		return bSeriesMapper;
	}

	public void setbSeriesMapper(BSeriesMapper bSeriesMapper) {
		this.bSeriesMapper = bSeriesMapper;
	}

	public BdictionaryMapper getBdictionaryMapper() {
		return bdictionaryMapper;
	}

	public void setBdictionaryMapper(BdictionaryMapper bdictionaryMapper) {
		this.bdictionaryMapper = bdictionaryMapper;
	}

	@Override
	public List<Bdictionary> findBdictionariesByCode(String code) {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysByCode(code);
	}

	@Override
	public List<Bdictionary> findChannels() {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysByType("CHANNEL");
	}

	@Override
	public List<Bdictionary> findAddress() {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysByType("AREA");
	}

	@Override
	public List<Bdictionary> findYear() {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysByType("YEAR");
	}

	//搜索查询
	@Override
	public List<BSeries> findBSeriesByPageVo(BSeries bSeries, PageUtil pageUtil, String sort) {
		// TODO Auto-generated method stub
		if (pageUtil!=null) {
			pageUtil.setPageSize(20);
			pageUtil.setPageNum((pageUtil.getPageNum()-1)*pageUtil.getPageSize());
		}else {
			pageUtil=new PageUtil();
			pageUtil.setPageNum(1);
			pageUtil.setPageSize(20);
		}
		return bSeriesMapper.searchSeriesByPageVo(bSeries, pageUtil, sort);
	}
    //根据名字查询
	@Override
	public List<BSeries> selectTypeName(String type) {
		 
		return bSeriesMapper.selectTypeName(type);
	}

	@Override
	public List<BSeries> selectTVPLAY(String type) {
		 
		return bSeriesMapper.selectTVPLAY(type);
	}

	@Override
	public List<BSeries> selectCARTOON(String type) {
		// TODO Auto-generated method stub
		return bSeriesMapper.selectCARTOON(type);
	}

	@Override
	public List<BSeries> selectLikeCount() {
		// TODO Auto-generated method stub
		return bSeriesMapper.selectLikeCount();
	}

	@Override
	public int getProductsCount(BSeries record) {
		// TODO Auto-generated method stub
		return bSeriesMapper.getProductsCount(record);
	}

	@Override
	public List<Bdictionary> selectPageInfo() {
		// TODO Auto-generated method stub
		return bdictionaryMapper.queryBdictionarysSearchPage();
	}

}
